package com.appbee.cm.client.regionunit.presenter;

import java.util.HashMap;

import javax.inject.Inject;
import javax.inject.Provider;
import javax.inject.Singleton;

import com.appbee.cm.client.regionunit.presenter.RegionActivity.View;

@Singleton
public class RegionViewProvider
{
	private final Provider<View> viewProvider;
	private final HashMap<String, View> regionViewMap = new HashMap<String, View>();

	@Inject
	public RegionViewProvider(Provider<View> viewProvider)
	{
		this.viewProvider = viewProvider;
	}

	public View getView(String regionId)
	{
		View view = regionViewMap.get(regionId);
		if (view == null)
		{
			view = viewProvider.get();
			regionViewMap.put(regionId, view);
		}
		return view;

	}

}
